import dayjs from 'dayjs';
import { downLoad, request } from '../../../request';

export function wipPlanprocess() {
  return request({
    url: `/rcerp/agv/plan/wipPlan/process`,
    method: 'get'
  });
}
export function wipPlancaption() {
  return request({
    url: `/rcerp/agv/plan/wipPlan/caption`,
    method: 'get'
  });
}
export function wipPlanlist(data: any) {
  return request({
    url: `/rcerp/agv/plan/wipPlan/list?pageNum=${data.pageNum}&pageSize=${data.pageSize}&prodNo=${data.moduleNo}&processId=${data.processId}&startTime=${data.time[0]}&endTime=${data.time[1]}&wipState=${data.wipState}&pnType=${data.pnType}&paramCaption=${data.paramCaption}`,
    method: 'get'
  });
}
export function planprodPlanlist(data: any) {
  return request({
    url: `/qms/agv/plan/prodPlan/list?pageNum=${data.pageNum}&pageSize=${data.pageSize}&prodNo=${data.moduleNo}&processId=${data.processId}&startTime=${data.time[0]}&endTime=${data.time[1]}&wipState=${data.wipState}&pnType=${data.pnType}&paramCaption=${data.paramCaption}`,
    method: 'get'
  });
}
export function qmsplanbatchInsert(data: any) {
  return request({
    url: `/qms/agv/plan/prodPlan/batchInsert`,
    method: 'post',
    data
  });
}
export function planexport(data: any) {
  return downLoad({
    url: `/rcerp/agv/plan/wipPlan/export?prodNo=${data.moduleNo}&processId=${data.processId}&startTime=${data.time[0]}&endTime=${data.time[1]}&userId=${data.userId}&wipState=${data.wipState}&pnType=${data.pnType}`,
    method: 'get',
    fileName: `在线排产计划表${dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`
  });
}
export function prodPlanexport(data: any) {
  return downLoad({
    url: `/qms/agv/plan/prodPlan/export?prodNo=${data.moduleNo}&processId=${data.processId}&startTime=${data.time[0]}&endTime=${data.time[1]}&userId=${data.userId}&wipState=${data.wipState}&pnType=${data.pnType}`,
    method: 'get',
    fileName: `生产排产计划表${dayjs().format('YYYY-MM-DD HH:mm:ss')}.xlsx`
  });
}
